load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "changefeedccl",
    srcs = [
        "alter_changefeed_stmt.go",
        "authorization.go",
        "avro.go",
        "batching_sink.go",
        "changefeed.go",
        "changefeed_dist.go",
        "changefeed_processors.go",
        "changefeed_stmt.go",
        "compression.go",
        "doc.go",
        "encoder.go",
        "encoder_avro.go",
        "encoder_csv.go",
        "encoder_json.go",
        "event_processing.go",
        "fetch_table_bytes.go",
        "metrics.go",
        "name.go",
        "parallel_io.go",
        "parquet.go",
        "parquet_sink_cloudstorage.go",
        "protected_timestamps.go",
        "retry.go",
        "scheduled_changefeed.go",
        "schema_registry.go",
        "scram_client.go",
        "sink.go",
        "sink_cloudstorage.go",
        "sink_external_connection.go",
        "sink_kafka.go",
        "sink_kafka_v2.go",
        "sink_pubsub.go",
        "sink_pubsub_v2.go",
        "sink_pulsar.go",
        "sink_sql.go",
        "sink_webhook.go",
        "sink_webhook_v2.go",
        "telemetry.go",
        "testing_knobs.go",
        "tls.go",
        "topic.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/build",
        "//pkg/ccl/backupccl/backupresolver",
        "//pkg/ccl/changefeedccl/cdceval",
        "//pkg/ccl/changefeedccl/cdcevent",
        "//pkg/ccl/changefeedccl/cdcutils",
        "//pkg/ccl/changefeedccl/changefeedbase",
        "//pkg/ccl/changefeedccl/changefeedpb",
        "//pkg/ccl/changefeedccl/changefeedvalidators",
        "//pkg/ccl/changefeedccl/kvevent",
        "//pkg/ccl/changefeedccl/kvfeed",
        "//pkg/ccl/changefeedccl/schemafeed",
        "//pkg/ccl/kvccl/kvfollowerreadsccl",
        "//pkg/ccl/utilccl",
        "//pkg/cloud",
        "//pkg/cloud/externalconn",
        "//pkg/cloud/externalconn/connectionpb",
        "//pkg/clusterversion",
        "//pkg/docs",
        "//pkg/featureflag",
        "//pkg/geo",
        "//pkg/geo/geopb",
        "//pkg/jobs",
        "//pkg/jobs/jobsauth",
        "//pkg/jobs/jobspb",
        "//pkg/jobs/jobsprofiler",
        "//pkg/jobs/jobsprotectedts",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/closedts",
        "//pkg/kv/kvserver/protectedts",
        "//pkg/kv/kvserver/protectedts/ptpb",
        "//pkg/multitenant",
        "//pkg/roachpb",
        "//pkg/scheduledjobs",
        "//pkg/scheduledjobs/schedulebase",
        "//pkg/security/username",
        "//pkg/server/status",
        "//pkg/server/telemetry",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/colinfo",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/resolver",
        "//pkg/sql/execinfra",
        "//pkg/sql/execinfrapb",
        "//pkg/sql/exprutil",
        "//pkg/sql/flowinfra",
        "//pkg/sql/isql",
        "//pkg/sql/parser",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/pgwire/pgnotice",
        "//pkg/sql/physicalplan",
        "//pkg/sql/physicalplan/replicaoracle",
        "//pkg/sql/privilege",
        "//pkg/sql/protoreflect",
        "//pkg/sql/roleoption",
        "//pkg/sql/rowenc",
        "//pkg/sql/rowexec",
        "//pkg/sql/sem/asof",
        "//pkg/sql/sem/builtins",
        "//pkg/sql/sem/catid",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sem/volatility",
        "//pkg/sql/sessiondata",
        "//pkg/sql/sessiondatapb",
        "//pkg/sql/syntheticprivilege",
        "//pkg/sql/types",
        "//pkg/util/admission",
        "//pkg/util/admission/admissionpb",
        "//pkg/util/bitarray",
        "//pkg/util/bufalloc",
        "//pkg/util/buildutil",
        "//pkg/util/cache",
        "//pkg/util/cancelchecker",
        "//pkg/util/ctxgroup",
        "//pkg/util/duration",
        "//pkg/util/encoding/csv",
        "//pkg/util/envutil",
        "//pkg/util/errorutil/unimplemented",
        "//pkg/util/hlc",
        "//pkg/util/httputil",
        "//pkg/util/humanizeutil",
        "//pkg/util/intsets",
        "//pkg/util/json",
        "//pkg/util/log",
        "//pkg/util/log/eventpb",
        "//pkg/util/log/logcrash",
        "//pkg/util/log/severity",
        "//pkg/util/metamorphic",
        "//pkg/util/metric",
        "//pkg/util/metric/aggmetric",
        "//pkg/util/mon",
        "//pkg/util/parquet",
        "//pkg/util/protoutil",
        "//pkg/util/quotapool",
        "//pkg/util/randutil",
        "//pkg/util/retry",
        "//pkg/util/span",
        "//pkg/util/syncutil",
        "//pkg/util/system",
        "//pkg/util/timeofday",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/uuid",
        "@com_github_apache_pulsar_client_go//pulsar",
        "@com_github_aws_aws_msk_iam_sasl_signer_go//signer",
        "@com_github_cockroachdb_apd_v3//:apd",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_logtags//:logtags",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_gogo_protobuf//jsonpb",
        "@com_github_gogo_protobuf//types",
        "@com_github_google_btree//:btree",
        "@com_github_ibm_sarama//:sarama",
        "@com_github_klauspost_compress//gzip",
        "@com_github_klauspost_compress//zstd",
        "@com_github_klauspost_pgzip//:pgzip",
        "@com_github_linkedin_goavro_v2//:goavro",
        "@com_github_rcrowley_go_metrics//:go-metrics",
        "@com_github_twmb_franz_go//pkg/kerr",
        "@com_github_twmb_franz_go//pkg/kgo",
        "@com_github_twmb_franz_go//pkg/kversion",
        "@com_github_twmb_franz_go//pkg/sasl",
        "@com_github_twmb_franz_go//pkg/sasl/oauth",
        "@com_github_twmb_franz_go//pkg/sasl/plain",
        "@com_github_twmb_franz_go//pkg/sasl/scram",
        "@com_github_twmb_franz_go_pkg_kadm//:kadm",
        "@com_github_xdg_go_scram//:scram",
        "@com_google_cloud_go_pubsub//:pubsub",
        "@com_google_cloud_go_pubsub//apiv1",
        "@com_google_cloud_go_pubsub//apiv1/pubsubpb",
        "@org_golang_google_api//impersonate",
        "@org_golang_google_api//option",
        "@org_golang_google_grpc//:go_default_library",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//credentials/insecure",
        "@org_golang_google_grpc//status",
        "@org_golang_x_oauth2//:oauth2",
        "@org_golang_x_oauth2//clientcredentials",
        "@org_golang_x_oauth2//google",
    ],
)

go_test(
    name = "changefeedccl_test",
    size = "enormous",
    srcs = [
        "alter_changefeed_test.go",
        "avro_test.go",
        "changefeed_dist_test.go",
        "changefeed_processors_test.go",
        "changefeed_test.go",
        "csv_test.go",
        "encoder_json_test.go",
        "encoder_test.go",
        "event_processing_test.go",
        "fetch_table_bytes_test.go",
        "helpers_test.go",
        "main_test.go",
        "name_test.go",
        "nemeses_test.go",
        "parquet_test.go",
        "protected_timestamps_test.go",
        "scheduled_changefeed_test.go",
        "schema_registry_test.go",
        "show_changefeed_jobs_test.go",
        "sink_cloudstorage_test.go",
        "sink_kafka_connection_test.go",
        "sink_kafka_v2_test.go",
        "sink_pulsar_test.go",
        "sink_test.go",
        "sink_webhook_test.go",
        "testfeed_test.go",
        "validations_test.go",
    ],
    embed = [":changefeedccl"],
    exec_properties = select({
        "//build/toolchains:is_heavy": {"test.Pool": "heavy"},
        "//conditions:default": {"test.Pool": "large"},
    }),
    shard_count = 16,
    deps = [
        "//pkg/base",
        "//pkg/blobs",
        "//pkg/ccl",
        "//pkg/ccl/changefeedccl/cdceval",
        "//pkg/ccl/changefeedccl/cdcevent",
        "//pkg/ccl/changefeedccl/cdctest",
        "//pkg/ccl/changefeedccl/changefeedbase",
        "//pkg/ccl/changefeedccl/changefeedpb",
        "//pkg/ccl/changefeedccl/kvevent",
        "//pkg/ccl/changefeedccl/mocks",
        "//pkg/ccl/changefeedccl/schemafeed/schematestutils",
        "//pkg/ccl/kvccl/kvtenantccl",
        "//pkg/ccl/multiregionccl",
        "//pkg/ccl/multiregionccl/multiregionccltestutils",
        "//pkg/ccl/partitionccl",
        "//pkg/ccl/storageccl",
        "//pkg/ccl/utilccl",
        "//pkg/cloud",
        "//pkg/cloud/impl:cloudimpl",
        "//pkg/internal/sqlsmith",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/jobs/jobstest",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/closedts",
        "//pkg/kv/kvserver/kvserverbase",
        "//pkg/kv/kvserver/protectedts",
        "//pkg/kv/kvserver/protectedts/ptpb",
        "//pkg/roachpb",
        "//pkg/scheduledjobs",
        "//pkg/scheduledjobs/schedulebase",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/security/username",
        "//pkg/server",
        "//pkg/server/serverpb",
        "//pkg/server/telemetry",
        "//pkg/settings/cluster",
        "//pkg/spanconfig",
        "//pkg/spanconfig/spanconfigptsreader",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/bootstrap",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/colinfo",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/catalog/schemaexpr",
        "//pkg/sql/catalog/tabledesc",
        "//pkg/sql/catalog/typedesc",
        "//pkg/sql/distsql",
        "//pkg/sql/enum",
        "//pkg/sql/execinfra",
        "//pkg/sql/execinfrapb",
        "//pkg/sql/flowinfra",
        "//pkg/sql/importer",
        "//pkg/sql/isql",
        "//pkg/sql/parser",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/randgen",
        "//pkg/sql/rowenc",
        "//pkg/sql/rowenc/keyside",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sem/volatility",
        "//pkg/sql/sessiondata",
        "//pkg/sql/sessiondatapb",
        "//pkg/sql/types",
        "//pkg/storage/enginepb",
        "//pkg/testutils",
        "//pkg/testutils/jobutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util",
        "//pkg/util/ctxgroup",
        "//pkg/util/encoding",
        "//pkg/util/hlc",
        "//pkg/util/intsets",
        "//pkg/util/json",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/log/eventpb",
        "//pkg/util/mon",
        "//pkg/util/parquet",
        "//pkg/util/protoutil",
        "//pkg/util/randident",
        "//pkg/util/randutil",
        "//pkg/util/retry",
        "//pkg/util/span",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/timeutil/pgdate",
        "//pkg/util/uuid",
        "//pkg/workload/bank",
        "//pkg/workload/ledger",
        "//pkg/workload/workloadsql",
        "@com_github_apache_pulsar_client_go//pulsar",
        "@com_github_cockroachdb_apd_v3//:apd",
        "@com_github_cockroachdb_cockroach_go_v2//crdb",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
        "@com_github_dustin_go_humanize//:go-humanize",
        "@com_github_gogo_protobuf//types",
        "@com_github_golang_mock//gomock",
        "@com_github_ibm_sarama//:sarama",
        "@com_github_jackc_pgx_v4//:pgx",
        "@com_github_lib_pq//:pq",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@com_github_twmb_franz_go//pkg/kerr",
        "@com_github_twmb_franz_go//pkg/kgo",
        "@com_github_twmb_franz_go//pkg/kversion",
        "@com_github_twmb_franz_go//pkg/sasl",
        "@com_github_twmb_franz_go_pkg_kadm//:kadm",
        "@com_google_cloud_go_pubsub//apiv1",
        "@com_google_cloud_go_pubsub//apiv1/pubsubpb",
        "@com_google_cloud_go_pubsub//pstest",
        "@org_golang_google_api//option",
        "@org_golang_google_grpc//:go_default_library",
        "@org_golang_google_grpc//credentials/insecure",
        "@org_golang_x_text//collate",
    ],
)
